import axios from '@/libs/api.request'

export const addNamespace = (data) => {
  return axios.request({
    url: 'application/namespaces/',
    data,
    method: 'post'
  })
}

export const deleteNamespace = (params) => {
  return axios.request({
    url: 'application/namespaces/',
    params,
    method: 'delete'
  })
}

export const namespaceList = () => {
  return axios.request({
    url: 'application/namespaces/',
    method: 'get'
  })
}

export const podsList = (params) => {
  return axios.request({
    url: 'application/pods/',
    params,
    method: 'get'
  })
}

export const podsAllSearch = (namespaceName, deploymentName) => {
  const params = {
    'namespace_name': namespaceName,
    'search': deploymentName
  }
  return axios.request({
    url: 'application/pods/',
    params,
    method: 'get'
  })
}

export const podsDelete = (params) => {
  return axios.request({
    url: 'production/pods/',
    params,
    method: 'delete'
  })
}

export const ingressList = (params) => {
  return axios.request({
    url: 'application/ingress/',
    params,
    method: 'get'
  })
}

export const ingressCreate = (data) => {
  return axios.request({
    url: 'application/ingress/',
    data,
    method: 'post'
  })
}

export const ingressDelete = (params) => {
  return axios.request({
    url: 'application/ingress/',
    params,
    method: 'delete'
  })
}
